home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / winlib.lzh / WINLIB / TESTHELP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-05  |  12.3 KB  |  337 lines

  1. /********************************************************************
  2.  *                                                                    *
  3.  *    Text help display routines for TEST program (text dialog)        *
  4.  *    by Ken Hollis                                                    *
  5.  *                                                                    *
  6.  *    Copyright (c) Bitgate Software and Clever Bits 1994                *
  7.  *    All rights reserved.                                            *
  8.  *                                                                    *
  9.  *    This is one of many methods that can be used to display text    *
  10.  *    within dialogs.  You can also use W_DIALOGICON | W_TEXT.        *
  11.  *                                                                    *
  12.  *    This file uses an array of text, and displays it within the        *
  13.  *    dialog's display work area.     This is not an actual WinLIB PRO    *
  14.  *    library routine.  These are routines we created ourself.  These    *
  15.  *    will eventually be implemented into WinLIB PRO as Text Dialogs,    *
  16.  *    but not yet.  We will give more details as time goes by.        *
  17.  *                                                                    *
  18.  *    Another nice feature we may add is Text Gadgets, as requested    *
  19.  *    from many libraries, but no other libraries offer them.  Maybe    *
  20.  *    we should!                                                        *
  21.  *                                                                    *
  22.  ********************************************************************/
  23.  
  24. #include <stddef.h>
  25. #include <stdlib.h>
  26. #include "winlib.h"
  27. #include "test.h"
  28.  
  29. static int lastpos, showable;
  30.  
  31. char *texthelp[] =
  32. {    "Welcome to WinLIB PRO version 0.64A.      ",
  33.     "                                          ",
  34.     "WinLIB PRO was conceived and designed     ",
  35.     "by the following remarkable people:       ",
  36.     "                                          ",
  37.     "Ken Hollis (khollis@bitsink.gbdata.com)   ",
  38.     "Karl 0ygard (karlo@ifi.uio.no)            ",
  39.     "Markus Gutschke (gutschk@uni-muenster.de) ",
  40.     "                                          ",
  41.     "New additions since last release (1993):  ",
  42.     "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"  ",
  43.     "- Internal custom help window             ",
  44.     "- New 3D Menu bar and sizing fix routines ",
  45.     "- Custom menubar handling routines        ",
  46.     "- Desktop routines with drag/drop protocol",
  47.     "- Menu bars with side-rooted objects      ",
  48.     "- Dropdown and popup menu bar routines    ",
  49.     "- Redraw-as-you-drag sliders (ultra-fast) ",
  50.     "- Multi-timer display (as many as wanted) ",
  51.     "- Call accessories through custom menubars",
  52.     "- Color icons with radio buttons          ",
  53.     "- ASCII-Table for editing (hit Insert)    ",
  54.     "- Redraw-as-you-drag modal dialog boxes   ",
  55.     "- Cookie management routines              ",
  56.     "- So much more                            ",
  57.     "                                          ",
  58.     "What is WinLIB Pro?                       ",
  59.     "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"                       ",
  60.     "WinLIB PRO is an object-oriented library  ",
  61.     "for the Atari ST offering many features   ",
  62.     "that GEM didn't ever normally offer.  This",
  63.     "GUI (Graphical User Interface) offers many",
  64.     "modifications to AES, and easier-to-use   ",
  65.     "and call functions for the AES and VDI.   ",
  66.     "There's not alot to tell about WinLIB PRO,",
  67.     "except for the fact that it is a one-of-a-",
  68.     "kind programming library.  There is none  ",
  69.     "available for the Atari ST that is quite  ",
  70.     "like this.                                ",
  71.     "                                          ",
  72.     "WinLIB PRO combines ideas from the follow-",
  73.     "ing programming libraries (and adds its   ",
  74.     "own ideas as well):                       ",
  75.     "                                          ",
  76.     "Enhanced GEM, Compact GEM, GEM++,         ",
  77.     "WindClass, Application Library (APP_LIB), ",
  78.     "Windows 3.1, Windows 4.0 (Chicago), Motif,",
  79.     "OpenLook, NeXTDesk, MultiTOS, Geneva,     ",
  80.     "InterFace (EXTOBFIX), Zoom! Color Icon    ",
  81.     "editor, XAES, XAES Pro, WAZ Text Library, ",
  82.     "Window Extensions (WinX), Mag!x and       ",
  83.     "WXLIB.                                    ",
  84.     "                                          ",
  85.     "WinLIB PRO combines interface designs from",
  86.     "InterFace, Zoom!, OpenLook, Motif, Geneva,",
  87.     "MultiTOS, NeXT, WindDesk, Window 3.1,     ",
  88.     "OS/2, and MultiScope (Sun)                ",
  89.     "                                          ",
  90.     "WinLIB PRO offers the following features: ",
  91.     "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\" ",
  92.     "- Our own OOP design                      ",
  93.     "- Everything is windowed (object oriented)",
  94.     "- Menubars can be inside windows          ",
  95.     "- Toolbox capability                      ",
  96.     "- 5 different 3D drawing styles           ",
  97.     "- Hotkeys (three different styles)        ",
  98.     "- Background clickable windows (like MTOS)",
  99.     "- Redraw-as-you-drag sliders (shown here) ",
  100.     "- Flying dialog boxes (with alert boxes)  ",
  101.     "- Color icon fixes and display            ",
  102.     "- Complete Extended Object Type fix,      ",
  103.     "  with object types compatible with Inter-",
  104.     "  Face Resource Construction Set          ",
  105.     "- Drag-and-drop protocols                 ",
  106.     "- Interprocess communication routines     ",
  107.     "- Custom desktop with iconifyable windows ",
  108.     "- Programs can run as ACC or PRG          ",
  109.     "- Custom windows                          ",
  110.     "- Dropdown, popup, and siderooted menus   ",
  111.     "- WinX, and Geneva compatibility          ",
  112.     "- Inquirable window closure               ",
  113.     "- Image scaling inside dialog boxes       ",
  114.     "- Customized window states, styles, and   ",
  115.     "  actions                                 ",
  116.     "- Task-switching multitasking timers      ",
  117.     "- Text windows with Hypertext type lookup ",
  118.     "- Standard and customized appl_getinfo    ",
  119.     "  call standard to most MultiTOS apps     ",
  120.     "- Custom resource file loader (64K limit  ",
  121.     "  is demolished)                          ",
  122.     "- Cookie management (get, create, delete, ",
  123.     "  move, clear, get size)                  ",
  124.     "- MultiTOS and Geneva name registration   ",
  125.     "- Modal/Non-modal dialog boxes            ",
  126.     "- Un-untoppable windows (as with this one)",
  127.     "- Custom text editing (inside objects)    ",
  128.     "- Editing ASCII-Table                     ",
  129.     "- Resource object intersection and inside ",
  130.     "  object management                       ",
  131.     "- Alert boxes with color icons            ",
  132.     "- Desktop functions like XWindows GUIs    ",
  133.     "- Change 3D drawing types at will         ",
  134.     "- Smart hotkeys                           ",
  135.     "- Internal title screen                   ",
  136.     "- Custom desktop menubar handler that     ",
  137.     "  supports sideroots of unlimited depths  ",
  138.     "- All resource files are WYSIWYG style    ",
  139.     "  (What you see is what you get)          ",
  140.     "- 3D Menu bar fixes                       ",
  141.     "- Cursor changes to I-Beam on editable    ",
  142.     "  text object fields                      ",
  143.     "- Customizable desktop                    ",
  144.     "  - Mouse can take form of mini-icon      ",
  145.     "    defined by yourself, or using the     ",
  146.     "    internal mouse forms                  ",
  147.     "  - Desktop background can display a      ",
  148.     "    picture                               ",
  149.     "- Window dominance settings (for the      ",
  150.     "  un-untoppable windows)                  ",
  151.     "                                          ",
  152.     "Current problems:                         ",
  153.     "\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"                         ",
  154.     "- Many features are still quite buggy     ",
  155.     "- Desktop routines are in dire need of    ",
  156.     "  being revamped                          ",
  157.     "- Text routines for hypertext are being   ",
  158.     "  redesigned...                           ",
  159.     "- MultiTOS HATES our 3D routines, and our ",
  160.     "  custom menubar handler.  Hopefully      ",
  161.     "  Markus Gutschke will give us some in-   ",
  162.     "  sight on fixes.                         ",
  163.     "- DESPERATELY needs a setup program       ",
  164.     "                                          ",
  165.     "Still to come:                            ",
  166.     "\"\"\"\"\"\"\"\"\"\"\"\"\"\"                            ",
  167.     "- All bugs totally and completely fixed   ",
  168.     "- Underscore bug fix (numerical fields)   ",
  169.     "- Completely working desktop routines     ",
  170.     "- Clipboard support for object pasting    ",
  171.     "  and saving object information           ",
  172.     "- Menus with scrollable menus             ",
  173.     "- Text Gadgets (by request)               ",
  174.     "                                          ",
  175.     "If you wish to see what bugs were fixed,  ",
  176.     "please consult \"BUGFIX.LOG\" for info.     ",
  177.     "                                          ",
  178.     "If you need to contact any of the authors ",
  179.     "for any reason, please contact us at:     ",
  180.     "                                          ",
  181.     "Ken Hollis  (khollis@bitsink.gbdata.com)  ",
  182.     "Karl 0ygard (karlo@ifi.uio.no)            ",
  183.     "                                          ",
  184.     "Since Karl 0ygard is away most of the time",
  185.     "it would be wise to write to Ken Hollis.  ",
  186.     "Besides, he's the head programmer, and can",
  187.     "probably answer all of your questions.    ",
  188.     "                                          ",
  189.     "We DARE you to find a faster, more        ",
  190.     "reliable OOP library that offers the same ",
  191.     "features as WinLIB PRO, and has the same  ",
  192.     "functionality, 3D effects, and other      ",
  193.     "modifications available.  Believe us when ",
  194.     "we say WinLIB PRO is ONE-OF-A-KIND.       ",
  195.     "                                          ",
  196.     "-- End of text --          Enjoy the demo!" };
  197.  
  198. #define tl    165
  199. #define    tw    42
  200.  
  201. void ShowText(WINDOW *win, int object, int amount)
  202. {
  203.     int i, start, end, vgstarter, vx, vy, clip[4], boundy;
  204.     int blit[8], sign, move;
  205.     MFDB src, dest;
  206.  
  207.     XVDI_SaveHandles();
  208.     vst_height(VDIhandle, 4, &i, &i, &i, &i);
  209.  
  210.     WGrafMouse(M_OFF);
  211.  
  212.     if (amount > 0)
  213.         sign = 1;
  214.     else
  215.         sign = -1;
  216.  
  217.     move = abs(amount);
  218.  
  219.     objc_offset(win->tree, object, &vx, &vy);
  220.     vgstarter = vy + gr_ch;
  221.  
  222.     clip[0] = vx + 2;
  223.     clip[1] = vy;
  224.     clip[2] = vx + 2 + win->tree[object].ob_width - 1;
  225.     clip[3] = vy + win->tree[object].ob_height - 1;
  226.     vs_clip(VDIhandle, 1, clip);
  227.  
  228.     boundy = vy + win->tree[object].ob_height;
  229.  
  230.     if (boundy < desk.g_y + desk.g_h) {
  231.         if ((move != 0) && (move < showable)) {
  232.             if (sign == 1) {
  233. /* src */        blit[0] = (vx + gr_cw);
  234.                 blit[1] = (vy + (move * gr_ch)) + 3;
  235.                 blit[2] = (vx + gr_cw) + (tw * gr_cw);
  236.                 blit[3] = (vy + (showable * gr_ch)) + 3;
  237.  
  238. /* dest */        blit[4] = (vx + gr_cw);
  239.                 blit[5] = vy + 3;
  240.                 blit[6] = (vx + gr_cw) + (tw * gr_cw);
  241.                 blit[7] = (vy + (showable * gr_ch)) + 3;
  242.             } else {
  243. /* src */        blit[0] = (vx + gr_cw);
  244.                 blit[1] = (vy + 3);
  245.                 blit[2] = (vx + gr_cw) + (tw * gr_cw);
  246.                 blit[3] = (vy + (showable * gr_ch)) - (move * gr_ch) + 3;
  247.  
  248. /* dest */        blit[4] = (vx + gr_cw);
  249.                 blit[5] = (vy + (move * gr_ch)) + 3;
  250.                 blit[6] = (vx + gr_cw) + (tw * gr_cw);
  251.                 blit[7] = (vy + (showable * gr_ch)) + 3;
  252.             }
  253.  
  254.             src.fd_addr = dest.fd_addr = NULL;
  255.             vro_cpyfm(VDIhandle, 3, blit, &src, &dest);
  256.         }
  257.  
  258.         if ((move) && (move < showable)) {
  259.             if (sign == 1) {
  260.                 start = ((win->slidpos[1] + showable) - move) - 1;
  261.                 end = (win->slidpos[1] + showable);
  262.                 vgstarter = (vy + ((showable - move) * gr_ch));
  263.             } else {
  264.                 start = win->slidpos[1];
  265.                 end = start + move;
  266.             }
  267.         } else {
  268.             start = win->slidpos[1];
  269.             end = ((start + showable) > tl) ? tl : (start + showable);
  270.         }
  271.  
  272.         i = start;
  273.  
  274.         while((i!=end) && (i < tl)) {
  275.             v_gtext(VDIhandle, (vx + gr_cw), vgstarter, texthelp[i]);
  276.             vgstarter += gr_ch;
  277.             i++;
  278.         }
  279.     } else {
  280.         i = start = win->slidpos[1];
  281.         end = ((start + showable) > tl) ? (tl - showable) : (start + showable);
  282.  
  283.         while((i!=end) && (i < tl)) {
  284.             v_gtext(VDIhandle, (vx + gr_cw), vgstarter, texthelp[i]);
  285.             vgstarter += gr_ch;
  286.             i++;
  287.         }
  288.     }
  289.  
  290.     clip[0] = desk.g_x;
  291.     clip[1] = desk.g_y;
  292.     clip[2] = desk.g_w;
  293.     clip[3] = desk.g_h;
  294.     vs_clip(VDIhandle, 1, clip);
  295.  
  296.     XVDI_RestoreHandles();
  297.  
  298.     WGrafMouse(M_ON);
  299. }
  300.  
  301. int Dlg6Dispatcher(WINDOW *win, int msg_buf[8])
  302. {
  303.     switch (*msg_buf) {
  304.         case WM_KILL:
  305.             return FALSE;
  306.  
  307.         case WM_CREATED:
  308.             showable = (win->tree[HTAREA].ob_height / gr_ch) - 1;
  309.             VerticalSlideReset(win, 1, (tl - showable), 0, HTSLIDE, HTTRACK, 0, 0);
  310.             return FALSE;
  311.  
  312.         case WM_PAINT:
  313.             ShowText(win, HTAREA, 0);
  314.             return FALSE;
  315.  
  316.         case WM_DIALOG:
  317.             switch(msg_buf[3]) {
  318.                 case HT_UP:
  319.                 case HT_DOWN:
  320.                 case HTSLIDE:
  321.                 case HTTRACK:
  322.                     lastpos = win->slidpos[1];
  323.  
  324.                     DoVerticalSlide(win, 1, HTTRACK, HTSLIDE,
  325.                                     HT_UP, HT_DOWN, msg_buf[3],
  326.                                     (showable - 2), 0);
  327.  
  328.                     if (lastpos != win->slidpos[1])
  329.                         ShowText(win, HTAREA, (-(lastpos - win->slidpos[1])));
  330.                     return FALSE;
  331.             }
  332.             return FALSE;
  333.     }
  334.  
  335.     return FALSE;
  336. }
  337.